/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package meuteste;

import java.io.IOException;
import java.sql.SQLException;
import java.util.TooManyListenersException;

/**
 *
 * @author tiago
 */
public class Meuteste {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException, InterruptedException, TooManyListenersException, SQLException, Exception {
//        StringBuilder stbRes = new StringBuilder(1000);
//        stbRes.append("icalzado\nH?t");
//        String teste = stbRes.toString();
//        System.out.println(teste);
//        if(stbRes.substring(0).matches("ica(.*)\n(.*)t") == false) {
//                                System.out.println("!stbRes.substring(0).matches(ica.*))");
//                            } else {
//                                System.out.println("stbRes.substring(0).matches(ica.*))");
//                            }
        
                TelaSelectBD telaSelectBD = new TelaSelectBD();
        telaSelectBD.setVisible(true);
        while (telaSelectBD.getBotaoApertado() == false) {
            Thread.sleep(200);
        }
        telaSelectBD.setVisible(false);
        DataHora dataHora = new DataHora();
        String bancodedados = telaSelectBD.getJTextFieldEnderecoBD().getText() + ":" +telaSelectBD.getJTextFieldPortaBD().getText() + "/" + telaSelectBD.getJTextFieldSchema().getText();
        Conexao conexao = new Conexao(bancodedados, telaSelectBD.getJTextFieldUsuarioBD().getText(), new String(telaSelectBD.getJTextFieldSenhaBD().getPassword()));
        OrdemDeServiço ordemDeServiço = new OrdemDeServiço(dataHora);
        PortaSerial portaSerial = new PortaSerial(38400, dataHora, conexao, ordemDeServiço); //, timer, timer2);
        TelaInicial telaInicial = new TelaInicial(portaSerial, conexao);
        telaInicial.setVisible(true);
    }
}
